package com.glink.gateway.service.user;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glink.gateway.domain.UserBean;
import com.glink.gateway.mapper.UserMapper;
import com.glink.gateway.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : qiushaoshan
 * @create 2024/6/18 10:27
 */
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, UserBean> implements UserService {

    @Override
    public UserVO findByUserName(String userName) {
        UserBean userBean = this.lambdaQuery().eq(UserBean::getUserName, userName).one();
        if (userBean == null) {
            return null;
        } else {
            UserVO userVO = new UserVO();
            BeanUtils.copyProperties(userBean, userVO);
            return userVO;
        }
    }
}
